import re

with open('single.html', encoding = 'utf-8') as f:

    content = f.read()

regex = '"images/.*?\.jpg"'


info = list(set(re.findall(regex, content)))

turn = ['\'{%static '+ i + '%}\'' for i in info]

for i in range(len(info)):

    content = re.sub(info[i], turn[i], content)

with open('single1.html','w',encoding = 'utf-8') as f:

    f.write(content)




